home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / plnk081.zip / pilot-link.0.8.1 / Java / Pdapilot / Database.java < prev    next >
Text File  |  1997-08-08  |  3KB  |  65 lines

  1.  
  2. package Pdapilot;
  3.  
  4.  
  5. public class Database {
  6.     public Record newRecord() { return new Record(); }
  7.     public Record newRecord(RecordID id)
  8.         { return new Record(null, id, 0, 0, 0); }
  9.     public Record newRecord(byte[] contents, RecordID id, int index, int attr, int cat) 
  10.         { return new Record(contents, id, index, attr, cat); }
  11.         
  12.     public Resource newResource() { return new Resource(); }
  13.     public Resource newResource(Char4 type, int id) 
  14.         { return newResource(null, type, id, 0); }
  15.     public Resource newResource(byte[] contents, Char4 type, int id, int index) 
  16.         { return new Resource(contents, type, id, index); }
  17.     
  18.     public Pref newPref() { return new Pref(); }
  19.     public Pref newPref(byte[] contents, Char4 creator, int id, int version, boolean backup)
  20.         { return new Pref(contents, creator, id, version, backup); }
  21.         
  22.     public AppBlock newAppBlock(){ return new AppBlock(); } 
  23.     public SortBlock newSortBlock() { return new SortBlock(); }
  24.     public AppBlock newAppBlock(byte[] contents){ return new AppBlock(contents); } 
  25.     public SortBlock newSortBlock(byte[] contents) { return new SortBlock(contents); }
  26.  
  27.     public Char4 creator() { return null; }
  28.     public String dbname() { return null; }
  29.     
  30.     static public java.util.Hashtable dbClasses = new java.util.Hashtable(10);
  31.     static public java.util.Hashtable prefClasses = new java.util.Hashtable(10);
  32.     static public Database defaultDbClass;
  33.     static public Database defaultPrefClass;
  34.     
  35.     static {
  36.         defaultDbClass = defaultPrefClass = new Database();
  37.  
  38.         Pdapilot.memo.Database memo = new Pdapilot.memo.Database();
  39.         Pdapilot.Database.dbClasses.put(memo.dbname(), memo);
  40.         Pdapilot.Database.prefClasses.put(memo.creator(), memo);
  41.  
  42.         Pdapilot.todo.Database todo = new Pdapilot.todo.Database();
  43.         Pdapilot.Database.dbClasses.put(todo.dbname(), todo);
  44.         Pdapilot.Database.prefClasses.put(todo.creator(), todo);
  45.  
  46.         Pdapilot.mail.Database mail = new Pdapilot.mail.Database();
  47.         Pdapilot.Database.dbClasses.put(mail.dbname(), mail);
  48.         Pdapilot.Database.prefClasses.put(mail.creator(), mail);
  49.  
  50.         Pdapilot.appointment.Database appointment = new Pdapilot.appointment.Database();
  51.         Pdapilot.Database.dbClasses.put(appointment.dbname(), appointment);
  52.         Pdapilot.Database.prefClasses.put(appointment.creator(), appointment);
  53.  
  54.         Pdapilot.expense.Database expense = new Pdapilot.expense.Database();
  55.         Pdapilot.Database.dbClasses.put(expense.dbname(), expense);
  56.         Pdapilot.Database.prefClasses.put(expense.creator(), expense);
  57.  
  58.         Pdapilot.address.Database address = new Pdapilot.address.Database();
  59.         Pdapilot.Database.dbClasses.put(address.dbname(), address);
  60.         Pdapilot.Database.prefClasses.put(address.creator(), address);
  61.  
  62.     }
  63.  
  64. }
  65.